/**
 * 船模 编辑页
 *
 * 作者 ganjun
 * 日期 2024-11-13 19:03:49
 */
layui.use(['jquery','febs', 'form', 'validate'], function () {
    var $ = layui.$,
        febs = layui.febs,
        layer = layui.layer,
        form = layui.form,
        $view = $('#modelShip-outFinish'),
        laydate = layui.laydate,

        validate = layui.validate;
    form.verify(validate);
    form.render();
    initFormValue();


    function initFormValue() {
        if (modelShipData) {
            form.val("modelShip-outFinish-form", {
                "id": modelShipData.id,
            });
        }
    }

    form.on('submit(modelShip-outFinish-form-submit)', function (data) {
        addOrUpdate(data.field);
        return false;
    });



    function addOrUpdate(data) {
        febs.modal.confirm("提交提示！","是否提交？",function (index){
            if (data.id && data.id.length > 0) {
                febs.postArray(ctx + 'modelShip/outFinish', data, function () {
                    layer.closeAll();
                    febs.alert.success('提交成功');
                    $('#febs-modelShip').find('#query').trigger('click');
                });
            }
        });
    }

    laydate.render({
        elem: "#actuallyStartdate",
        type: 'datetime',
        format: 'yyyy-MM-dd HH:mm',
    });

    laydate.render({
        elem: "#actuallyEnddate",
        type: 'datetime',
        format: 'yyyy-MM-dd HH:mm',
    });
});